package chapter03.chapter04;
class Teacher{
    String teacherID;// 教师编号
    /**
     * 关键词this
     * 关键词static
     */
    /**
     * 类属性 每个对象都可以继承()
     */
    String dep = "信息工程系";
    static String hobby = "健身";
    public Teacher(String teacherID){
        //当形象名称跟类属性名称一致时 分不清 函数默认时形象名称
        //teacherID = teacherID;
        /**
         * 使用this指类本身
         * 无关键字是形参 看关键字this是类的属性
         * this也可以调用本函数内部其他属性和方法
         */
        this.teacherID = teacherID;
    }
    public String getTeacherID(){
        return teacherID;
    }
    public void setTeacherID(String teacherID){
        this.teacherID=teacherID;
    }
}


public class demo4 {
    public static void main(String[] args){
        Teacher t1 = new Teacher("2023S2004");
        Teacher t2 = new Teacher("2023S2001");
        System.out.println(t1.dep);
        System.out.println(t1.dep);
        System.out.println("*********");
        t1.dep = "宇宙系";
        System.out.println(t1.dep);
        System.out.println(t1.dep);
        System.out.println("静态属性");
        System.out.println(t1.hobby);
        System.out.println(t2.hobby);
        t2.hobby = "美的设计";
        System.out.println("*********");
        System.out.println(t1.hobby);
        System.out.println(t2.hobby);
    }
}
